package dao

type IDao[Ent any] interface {

	// 查找某个
	FindOne(cds ...any) (*Ent, error)
	FindMulti(cds ...any) ([]*Ent, int64, error)
	Count(cds ...any) (int64, error)

	// 新建
	Create(ent *Ent, cds ...any) (*Ent, error)
	CreateMulti(ents []*Ent, cds ...any) (int64, error)

	// 更新
	Update(ent *Ent, cds ...any) (*Ent, error)
	UpdateColumns(cols []any, cds ...any) (int64, error)

	// 删除
	SoftDelete(cds ...any) error
	ForceDelete(cds ...any) error

	// 联表
	Association(model *Ent, column string, cds ...any) (IAssociation, error)
}

type IAssociation interface {
	// 替换
	Replace(vals ...any) error

	// 追加
	Append(vals ...any) error

	// 删除
	Delete(vals ...any) error

	// 查找
	Find(output any, query any, args ...any) error

	// 清空
	Clear() error

	// 数量
	Count() int64
}
